﻿using System.Globalization;

namespace Microsoft.Xna.Framework.Graphics
{
    /// <summary>
    /// Describes the display mode.
    /// </summary>
    public struct DisplayMode
    {
		internal SurfaceFormat _format;
		internal int _height;
		internal int _width;

		#region Properties
		/// <summary>
        /// Gets the aspect ratio used by the graphics device.
        /// </summary>
        public float AspectRatio
        {
            get { return Width / Height; }
        }

		/// <summary>
		/// Gets a value indicating the surface format of the display mode.
		/// </summary>
		public SurfaceFormat Format
		{
			get { return _format; }
		}

		/// <summary>
		/// Gets a value indicating the screen height, in pixels.
		/// </summary>
		public int Height
		{
			get { return _height; }
		}

		/// <summary>
		/// Returns the title safe area of the display.
		/// </summary>
		public Rectangle TitleSafeArea
		{
			get { return new Rectangle(0, 0, _width, _height); }
		}

        /// <summary>
        /// Gets a value indicating the screen width, in pixels.
        /// </summary>
        public int Width
        {
            get { return _width; }
        }
		#endregion

		internal DisplayMode(int width, int height, SurfaceFormat format)
		{
			this._width = width;
			this._height = height;
			this._format = format;
		}

		/// <summary>
		/// Retrieves a string representation of this object.
		/// </summary>
		public override string ToString()
		{
			return string.Format(CultureInfo.CurrentCulture, "{{Width:{0} Height:{1} Format:{2} AspectRatio:{3}}}", this._width, this._height, this._format, this.AspectRatio);
		}
    }
}
